<template>
  <div id="container">
    <div class="navbar">
      <img :src="logo" alt class="float-left" height="60px"/>
    </div>
    <div class="info">
      <div class="info-img">
        <img :src="docPic" alt height="120px"/>
        <p style="font-size:18px">密码找回</p>
      </div>
      <el-form
        :model="ruleForm"
        :rules="rules"
        ref="ruleForm"
        label-position="right"
        label-width="200px"
        class="info-form"
      >
        <el-form-item label="姓名" prop="name" class="ipt-item">
          <el-input v-model="ruleForm.name"></el-input>
        </el-form-item>
        <el-form-item label="手机号码" prop="mobile" class="ipt-item">
          <el-input v-model="ruleForm.mobile"></el-input>
        </el-form-item>
        <el-form-item label="验证码" prop="rectify" class="ipt-item">
          <el-input placeholder="请输入内容" v-model="ruleForm.rectify" class="input-with-select">
            <el-button slot="append" type="default" size="medium">获取验证码</el-button>
          </el-input>
        </el-form-item>
        <!-- <el-form-item label="密码" prop="newPassword" class="ipt-item">
          <el-input v-model="ruleForm.newPassword" show-password></el-input>
        </el-form-item>
        <el-form-item label="确认密码" prop="confirmPassword" class="ipt-item">
          <el-input v-model="ruleForm.confirmPassword" show-password></el-input>
        </el-form-item> -->
      </el-form>

      <div class="info-bottom">
        <el-button type="primary" class="info-btn" @click="goNext">下一步</el-button>
        <el-button type="default" class="info-btn" @click="goBack">返回</el-button>
      </div>
    </div>
  </div>
</template>
<script>
import Logo from '@/assets/images/logo-light.png'
import DocPic from '@/assets/images/doctor_lg.png'

export default {
  name: 'Claim',
  data() {
    var validatePassword = (rule, value, callback) => {
      if (value.length <= 5) {
        callback(new Error('密码需要大于5位'))
      } else {
        callback()
      }
    }
    var validateRepassword = (rule, value, callback) => {
      if (value.length <= 5) {
        callback(new Error('密码需要大于5位'))
      } else {
        callback()
      }
    }
    return {
      logo: Logo,
      docPic: DocPic,
      // pwdChange:false,
      ruleForm: {
        mobile: '', // 新密码
        rectify: '', // 验证码
        confirmPassword: '', // 再次新密码
        oldPassword: '', // 原密码
        name: ''
      },
      rules: {
        name: [
          { required: true, trigger: 'blur', validator: validatePassword }
        ],
        rectify: [
          { required: true, trigger: 'blur', validator: validatePassword }
        ],
        mobile: [
          { required: true, trigger: 'blur', validator: validateRepassword }
        ]
      }
    }
  },
  methods: {
    goNext() {
      this.$refs.ruleForm.validate((valid) => {
        if (valid) {
          this.$router.push({
            path: '/resetpwd'
          })
        }
      })
    },
    resetRuleForm() {
      this.ruleForm = {
        newPassword: '', // 新密码
        confirmPassword: '', // 再次新密码
        oldPassword: '' // 原密码
      }
    },
    goBack() {
      window.history.go(-1)
    }
    //  goBack(){
    //   this.$emit('goBack');
    // },
  }
}
</script>

<style lang="scss" scoped>
$bg: #31414f;
#container {
  width: 100%;
  //   height: 100%;
  position: relative;
  overflow: hidden;
  background-color: $bg;
}
.navbar {
  height: 60px;
  overflow: hidden;
  position: relative;
  background-color: #061528;
  box-shadow: 0 1px 4px rgba(0, 21, 41, 0.08);
}
.info {
  margin: 100px 120px;
  position: relative;
  background: #fff;
  border-radius: 7px;
  padding: 15px 0px 0px;
  .info-img {
    text-align: center;
    margin-top: -86px;
  }
  .info-title {
    margin: 20px 40px;
    padding-left: 15px;
    height: 40px;
    line-height: 40px;
    background-color: #f2f2f2;
  }
  .info-form {
    width: 75%;
    padding: 30px 0;
    padding-left: 15%;
  }
  .info-bottom {
    background-color: #f5f5f5;
    text-align: center;
    padding: 15px;
    .info-btn {
      width: 120px;
      margin-right: 20px;
    }
  }
}
</style>
